import React, {useEffect, useState} from "react";
import './personal-notice.scss'
import {Table} from "antd";
import {getAnnouncement} from "../../../api/announcementApi";

function PersonalNotice(props){

    const [data, setData] = useState([])

    const columns = [
        {
            title: '序号',
            dataIndex: 'id',
            key: 'id'
        },
        {
            title: '消息通知',
            dataIndex: 'content',
            key: 'content'
        },
        {
            title: '时间',
            dataIndex: 'createdAt',
            key: 'createdAt'
        }
    ]

    const getData = () => {
        getAnnouncement(14)
            .then(res => {
                setData(res)
            })
    }

    useEffect(() => {
        getData()
    }, []);


    return(
        <div>
            <Table columns={columns} dataSource={data}/>
        </div>
    )
}

export default PersonalNotice